package com.example.ck.utils;

import java.util.Random;

public class NumUtil {
    /**
     * 生成随机验证码
     */
    public static int createCode(int length) {
        StringBuffer buffer = new StringBuffer();
        Random random = new Random();
        for (int i = 0; i < length; i++) {
            buffer.append(random.nextInt(10));
        }
        return Integer.parseInt(buffer.toString());
    }
}
